import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useFileStore = defineStore(
  'file',
  () => {
    const fileName = ref<string>('')
    const fileBase64 = ref<string>('')

    function setFile(name: string, base64: string) {
      fileName.value = name
      fileBase64.value = base64
    }
    function clearFile() {
      fileName.value = ''
      fileBase64.value = ''
    }

    return { fileName, fileBase64, setFile, clearFile }
  },
  {
    persist: true,
  },
)
